#include <bits/stdc++.h>
using namespace std;
int a[100005],last_num,cnt;
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    last_num=a[0];
    cnt=1;
    int ans=n;
    for(int i=1;i<n;i++)
    {
        if(a[i]==last_num)
        {
            cnt++;
            continue;
        }
        ans--;
        if(!cnt)
        {
            int c=upper_bound(a,a+n,last_num)-a;
            cnt=upper_bound(a,a+n,a[c])-a-c;
            last_num=a[c];
        }
        cnt--;
    }
    cout<<ans<<endl;
    return 0;
}
